package com.eight.cloud.core.global.result;

import lombok.Getter;

/**
 * @EnumName: ResultCode
 * @Author: TXC
 * @Date: 2024-10-29 16:01
 **/
@Getter
public enum ResultCode implements IResultCode {
    /**
     * 成功
     */
    OK(200, "成功"),
    /**
     * 失败
     */
    ERROR(500, "失败"),
    SYSTEM_ERROR(501, "系统错误"),
    UNKNOWN_ERROR(502, "未知错误"),
    NO_PERMISSION(403, "没有权限"),
    NO_FOUND(404, "接口不存在"),
    /**
     * 服务异常
     */
    BAD_REQUEST(400, "服务开小差了"),

    /* 参数错误：1000～1999 */
    PARAM_NOT_VALID(1001, "参数无效"),
    PARAM_IS_BLANK(1002, "参数为空"),
    PARAM_TYPE_ERROR(1003, "参数类型错误"),
    PARAM_NOT_COMPLETE(1004, "参数缺失"),
    PARAM_TYPE_REPEAT(1005, "参数重复"),

    /* 用户错误 */
    USER_NOT_LOGIN(2001, "用户未登录"),
    USER_ACCOUNT_EXPIRED(2002, "登陆已过期"),
    USER_CREDENTIALS_ERROR(2003, "账号或密码错误"),
    USER_CREDENTIALS_EXPIRED(2004, "密码过期"),
    USER_ACCOUNT_DISABLE(2005, "账号不可用"),
    USER_ACCOUNT_LOCKED(2006, "账号被锁定"),
    USER_ACCOUNT_NOT_EXIST(2007, "账号不存在"),
    USER_ACCOUNT_NOT_NULL(2013, "账号不能为空"),
    USER_CREDENTIALS_NOT_NULL(2014, "密码不能为空"),
    USER_ACCOUNT_ALREADY_EXIST(2008, "账号已存在"),
    USER_ACCOUNT_USE_BY_OTHERS(2009, "账号下线"),
    PASSWORD_SAME(2010, "新密码与原密码一致"),

    ACCOUNT_OR_PASSWORD_NOT_NULL(2016, "账号或者密码不能为空"),
    PHONE_ALREADY_EXIST(2017, "电话号码已存在"),

    /* token错误 */
    TOKEN_IS_NULL(2011, "token不能为空"),
    TOKEN_INVALID(2012, "token失效"),
    TOKEN_ERROR(2015, "token错误"),

    /* 业务错误 */
    ADD_FAIL(3002, "新增失败"),
    UPDATE_FAIL(3003, "更新失败"),
    DELETE_FAIL(3004, "删除失败"),
    QUERY_FAIL(3005, "查询失败"),
    QUERY_EMPTY(3006, "查询为空"),
    QUERY_NOT_EXIST(3007, "查询不存在"),

    EMAIL_ERROR(2060, "邮箱格式错误"),
    PHONE_ERROR(2061, "电话格式错误"),
    EMAIL_REPEAT_ERROR(2062, "邮箱已存在"),

    /* 文件读写 */
    FILE_IS_NULL(2041, "文件为空"),
    FILE_WRONG_FORMAT(2042, "文件格式错误"),
    FILE_CHUNK_UPLOAD_ERROR(2043, "文件分块上传失败！"),
    FILE_CHUNK_MERGE_ERROR(2044, "文件分块合并失败"),
    FILE_CONTENT_ERROR(2045, "上传文件内容错误"),

    /**
     * 数据导出
     */
    EXPORT_FAILURE(2100, "导出失败"),
    /**
     * 数据导入
     */
    IMPORT_FAILURE(2101, "导入失败");

    /**
     * 返回码
     */
    private final Integer code;

    /**
     * 返回消息
     */
    private final String message;

    ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
}
